#include "searchplugin.h"
#include <WhaleButton>
#include <QtDebug>
#include <QString>

SearchTab * SearchPlugin::generateTab() {
    SearchTab * newTab = new SearchTab();
    return newTab;
}

SearchTab * SearchPlugin::restoreTab( QVariant query ) {
    return new SearchTab( query.toString() );
}

WhalePluginStarter * SearchPlugin::generateStarter() {
    WhalePluginStarter * starter = new WhalePluginStarter();
    starter->setIcon( QIcon( ":/images/oxygen/search.png" ) );
    starter->setWhatsThis( "Add a new tab" );

    return starter;
}

QString SearchPlugin::name() {
    return QString( "Search Plugin" );
}

QVariant SearchPlugin::constructors( WhaleTabBase * tab ) {
    QString query = qobject_cast< SearchTab * >( tab )->lastQuery();
    return QVariant( query );
}

Q_EXPORT_PLUGIN2( searchplugin, SearchPlugin );
